package ichubcontext

import (
	"context"
	"gitee.com/ichub/goconfig/common/base/baseconsts"
	"gitee.com/ichub/goconfig/common/base/encrypt"
	"gitee.com/ichub/goconfig/godi/godifactroy"
	"github.com/sirupsen/logrus"
	"testing"
)

func Test001_cfg(t *testing.T) {

	IchubClient.RegisterEncDec(encrypt.EncDecInst)

	var swag = IchubClient.IchubConfig().ReadWebSwagger()
	logrus.Info(swag)
}
func Test002_FindOneDiFactry(t *testing.T) {
	var factry = godifactroy.FindBeanDiFactroy()
	var fileinfo = factry.Parse("./ichub_common_context.go")
	logrus.Info(fileinfo)
	factry.MakeBatch(fileinfo.StructInfos[0])
}
func Test002_Gredis(t *testing.T) {
	var gredis = FindBeanIchubClientFactroy().IniGredisClient().Gredis()
	gredis.Set(context.Background(), "key", "222")
	logrus.Info(gredis.Get(context.Background(), "key"))
}
func Test002_FindCfg(t *testing.T) {
	var cfg = FindBeanIchubClientFactroy().FindConfig(baseconsts.ENV_DEV)
	var cfg1 = FindBeanIchubClientFactroy().FindConfig(baseconsts.ENV_DEV)
	var cfg2 = FindBeanIchubClientFactroy().FindConfig(baseconsts.ENV_TEST)
	logrus.Info(cfg2, cfg1 == cfg)
}
